package lib

import "log"

type dog struct{}

type cat struct{}

func (d *dog) call() string {
	return "wangwang"
}

func (c *cat) call() string {
	return "miaomiao"
}

func (c *cat) dump() {
	log.Println("dump")
}

type animal interface {
	call() string
}

//classload 测试输出函数
func classLoad() {
	fammilyDog := &dog{}
	fammilyCat := &cat{}
	var fammilyAnimal animal
	//interface实现dog和对应方法，
	//这里需要注意的时，interface只能实现定义过的对应struct的函数（就比如这里的call,cat的dump就不能通过这种方法访问
	fammilyAnimal = fammilyDog
	log.Println(fammilyAnimal.call())
	//interface实现cat和对应方法
	fammilyAnimal = fammilyCat
	log.Println(fammilyAnimal.call())
}
